<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@include file="../common/common.jsp" %>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/regist_login.js"></script>
<title>Hami鲜花-欢迎注册</title>
<link rel="stylesheet" href="<%=request.getContextPath() %>/css/regist.css">
</head>
<body>
	<%@include file="frame/top.jsp" %>
	<div class="container">
		<div class="main_div">
		<form class="form-horizontal form-regist" action="<%=request.getContextPath() %>/doRegist.action" method="post" role="form" onsubmit="return checkRegistForm();">
			<div class="from-group">
				<%
					String errorMsg = (String)request.getAttribute("errorMsg");
					if(errorMsg != null && !errorMsg.equals("")) {
				%>
					<p id="errorMsg" style="color: red;"><%=errorMsg %></p>
				<%
					}
				%>
			</div>
			<div class="col-md-3"></div>
			<div class="col-md-9">
				<h2 class="form-regist-heading">欢迎注册</h2>
			</div>
			<div class="form-group">
				<label for="registEmail" class="col-md-3 control-label">邮箱</label>
				<div class="col-md-9">
					<input type="email" class="form-control" id="registEmail" name="registEmail" placeholder="请输入合法邮箱" required autofocus>
					<span id="emailSuccessTip" class="label label-success" style="display: none;">有效</span>
					<span id="emailErrorTip" class="label label-warning" style="display: none;">请输入合法邮箱</span>
				</div>
			</div>
			<div class="form-group">
				<label for="registPhone" class="col-md-3 control-label">手机号</label>
				<div class="col-md-9">
					<input type="text" class="form-control" id="registPhone" name="registPhone" placeholder="请输入手机号" required>
					<span id="phoneSuccessTip" class="label label-success" style="display: none;">有效</span>
					<span id="phoneErrorTip" class="label label-warning" style="display: none;">请输入有效手机号</span>
				</div>
			</div>
			<div class="form-group">
				<label for="registPassword" class="col-md-3 control-label">密码</label>
				<div class="col-md-9">
					<input type="password" class="form-control" id="registPassword" name="registPassword" placeholder="请输入6~10位数字/字母密码" required>
					<span id="passwordSuccessTip" class="label label-success" style="display: none;">有效</span>
					<span id="passwordErrorTip" class="label label-warning" style="display: none;">请输入合规密码</span>
				</div>
			</div>
			<div class="form-group">
				<label for="registRePassword" class="col-md-3 control-label">确认密码</label>
				<div class="col-md-9">
					<input type="password" class="form-control" id="registRePassword" name="registRePassword" placeholder="请确认密码" required>
					<span id="rePasswordSuccessTip" class="label label-success" style="display: none;">有效</span>
					<span id="rePasswordErrorTip" class="label label-warning" style="display: none;">两次密码不一致</span>
				</div>
			</div>
			<div class="form-group">
				<div class="col-md-3"></div>
				<div class="col-md-9">
					<button class="btn btn-lg btn-primary btn-block" type="submit">确认注册</button>
				</div>
			</div>
		</form>
		</div>
	</div>
	<%@include file="frame/feet.jsp" %>
</body>

<script type="text/javascript">

	$(function() {
		$('#registEmail').blur(function() {
			checkEmail('registEmail');
		});
		$('#registPhone').blur(function() {
			checkPhone('registPhone');
		});
		$('#registPassword').blur(function() {
			checkPassword('registPassword');
		});
		$('#registRePassword').blur(function() {
			checkRePassword();
		});
	});

	function checkRegistForm() {
		if(!checkEmail('registEmail')) {
			return false;
		}else if(!checkPhone('registPhone')) {
			return false;
		}else if(!checkPassword('registPassword')) {
			return false;
		}else if(!checkRePassword()) {
			return false;
		}
		return true;
	}
</script>

</html>